Imports System
Imports ValidationFramework


Public Class CompareDecimalRuleAttributeExample
    ' Methods
    Public Sub DoSomething( _
    <CompareDecimalRule(5, CompareOperator.LessThan)> ByVal paramData As Decimal)
        ParameterValidationManager.ThrowException(Me, doSomethingHandle, paramData)
    End Sub


    ' Properties
    <CompareDecimalRule(5, CompareOperator.LessThan)> _
    <CompareDecimalRule(2, CompareOperator.GreaterThan, _
    ErrorMessage:="Data must be greater than 2.")> _
    Public Property Data() As Decimal
        Get
            Return _data
        End Get
        Set(ByVal value As Decimal)
            _data = value
        End Set
    End Property


    ' Fields
    Private _data As Decimal
    Private Shared ReadOnly doSomethingHandle As RuntimeMethodHandle = _
    GetType(CompareDecimalRuleAttributeExample).GetMethod("DoSomething").MethodHandle
End Class

